home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / lib / mntlib44.zoo / mntlib / chown.c < prev    next >
C/C++ Source or Header  |  1994-03-01  |  618b  |  35 lines

  1. /* chown -- change the owner and group of a file */
  2. /* written by Eric R. Smith and placed in the public domain */
  3. /* this is faked if MiNT is not running */
  4.  
  5. #include <types.h>
  6. #include <stat.h>
  7. #include <osbind.h>
  8. #include <mintbind.h>
  9. #include <limits.h>
  10. #include <errno.h>
  11. #include <unistd.h>
  12. #include "lib.h"
  13.  
  14. extern int __mint;
  15.  
  16. int
  17. chown(_name, uid, gid)
  18.        const char *_name;
  19.        int uid, gid;
  20. {
  21.     int r;
  22.     char name[PATH_MAX];
  23.  
  24.     if (__mint >= 9) {
  25.         (void)_unx2dos(_name, name);
  26.         r = (int)Fchown(name, uid, gid);
  27.         if (r && (r != -EINVAL)) {
  28.             errno = -r;
  29.             return -1;
  30.         }
  31.         return 0;
  32.     }
  33.     return 0;
  34. }
  35.